package com.gz.entity.Vo;

import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
public class CartItemVo {
    private Long userId;  //用户id
    private Long bookId;   //图书id
    private String press;  //出版社
    private String name;   //书名
    private String image;  //图书图片
    private Double price;   //单价
    private Integer quantity; //数量
    private Double sum; //金额

    //带部分参数的构造器
    public CartItemVo(Long userId, Long bookId, String name, String image, Double price, Integer quantity) {
        this.userId = userId;
        this.bookId = bookId;
        this.name = name;
        this.image = image;
        this.price = price;
        this.quantity = quantity;
    }

    //计算金额的方法
    public Double getPriceToQuantitySum() {
        return price * quantity;
    }
}
